package com.chengjue.controller;

import com.chengjue.common.ServerResponse;
import com.chengjue.service.ItemCatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/itemcat")
public class ItemCatController {
    @Autowired
    ItemCatService itemCatService;

    /**
     * 根绝parent id 获取商品分类信息
     * @param id
     * @return
     */
    @RequestMapping(value = "/list/{id}", method = RequestMethod.GET)
    public ServerResponse getItemCatByParentId(@PathVariable Long id){
        return itemCatService.getItemCatByParentId(id);
    }
}
